package sk.stuba.fiit.repka.dp.rating.gui;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;

import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;

public class RatingPropertiesPanel extends JPanel {
	
	private JTextPane ratingInformationsTP;
	
	public JTextPane getRatingInformationsTP() {
		return this.ratingInformationsTP;
	}
	
	private ButtonGroup group;
	
	public ButtonGroup getRatingButtonGroup() {
		return this.group;
	}
	
	/**
	 * Create the panel.
	 */
	public RatingPropertiesPanel() {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{0, 0};
		gridBagLayout.rowHeights = new int[]{247, 0, 0};
		gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		JPanel ratingTextPanel = new JPanel();
		ratingTextPanel.setBorder(new TitledBorder(null, "Informations", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		GridBagConstraints gbc_ratingTextPanel = new GridBagConstraints();
		gbc_ratingTextPanel.insets = new Insets(0, 0, 5, 0);
		gbc_ratingTextPanel.fill = GridBagConstraints.BOTH;
		gbc_ratingTextPanel.gridx = 0;
		gbc_ratingTextPanel.gridy = 0;
		add(ratingTextPanel, gbc_ratingTextPanel);
		ratingTextPanel.setLayout(new GridLayout(1, 0, 0, 0));
		
		ratingInformationsTP = new JTextPane();
		ratingTextPanel.add(ratingInformationsTP);
		
		JPanel ratingValuesPanel = new JPanel();
		ratingValuesPanel.setBorder(new TitledBorder(null, "Rating", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		GridBagConstraints gbc_ratingValuesPanel = new GridBagConstraints();
		gbc_ratingValuesPanel.fill = GridBagConstraints.BOTH;
		gbc_ratingValuesPanel.gridx = 0;
		gbc_ratingValuesPanel.gridy = 1;
		add(ratingValuesPanel, gbc_ratingValuesPanel);
		ratingValuesPanel.setLayout(new GridLayout(1, 0, 0, 0));
		
		JRadioButton ratingRB1 = new JRadioButton("1");
		ratingRB1.setHorizontalAlignment(SwingConstants.CENTER);
		ratingRB1.setSelected(true);
		ratingValuesPanel.add(ratingRB1);
		
		JRadioButton ratingRB2 = new JRadioButton("2");
		ratingRB2.setHorizontalAlignment(SwingConstants.CENTER);
		ratingValuesPanel.add(ratingRB2);
		
		JRadioButton ratingRB3 = new JRadioButton("3");
		ratingRB3.setHorizontalAlignment(SwingConstants.CENTER);
		ratingValuesPanel.add(ratingRB3);
		
		JRadioButton ratingRB4 = new JRadioButton("4");
		ratingRB4.setHorizontalAlignment(SwingConstants.CENTER);
		ratingValuesPanel.add(ratingRB4);
		
		JRadioButton ratingRB5 = new JRadioButton("5");
		ratingRB5.setHorizontalAlignment(SwingConstants.CENTER);
		ratingValuesPanel.add(ratingRB5);
		
		group = new ButtonGroup();
		group.add(ratingRB1);
		group.add(ratingRB2);
		group.add(ratingRB3);
		group.add(ratingRB4);
		group.add(ratingRB5);
	}

}
